def getMenuOption(debug = False):
	if debug:
		print "getMenuOption Function"
	validInput = False
	while not validInput:
		option = raw_input("> ")
		option = option.lower()
		if option == "1":
			validInput = True
		elif option == "2":
			validInput = True
		elif option == "3":
			validInput = True
		elif option == "swearfiltertoggle" or option == "toggleswearfilter":
			option = "swearfiltertoggle"
			validInput = True
		elif (option == "exit" or
			  option == "x" or
			  option == "quit" or
			  option == "q"):
				  option = "exit"
				  validInput = True
		else:
			print "please type a valid option"
			validInput = False
	if debug:
		print "Option is:", option
	return option
			
def getWord(prompt, swearFiltering, debug = False):
	if debug:
		print "getWord Function", prompt
	validInput = False
	while not validInput:
		option = raw_input(prompt)
		validInput = True
		if option == "":
			print "please type a word"
			validInput = False
		elif isSwear(option, debug) and swearFiltering:
			print "Don't say such naughty things!"			 
			validInput = False
	if debug:
		print "Option:", option 
	return option

def getNumber(prompt, debug = False):
	if debug:
		print "getNumber Function", prompt
	validInput = False
	while not validInput:
		option = raw_input(prompt)
		allowedChars = "123456789."
		validInput = True
		for letter in option:
			if debug:
				print letter
			if not(letter in allowedChars):
				validInput = False
		if not validInput:
			print "please type a number"
	if debug:
		print "Option: ", option
	return option
			
def isSwear(word, debug = False):
	if debug: 
		print "In isSwear Function", word
	swearList = ["fuck",
				"shit",
				"nipple",
				"ass",
				"sex",
				"penis",
				"bitch",
				"bastard",
				"cunt",
				"pussy",
				"cock",
				"dick",
				"jerk",
				"boob",
				"damn",
				"arse",
				"fag",
				"twat",
				"rape",
				"tit",
				"whore",
				"blazeit",
				"poop",]
	for swear in swearList:
		if swear in word.lower():
			return True
	return False

		




